home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 26 / Cream of the Crop 26.iso / program / ddj0897.zip / RCSC.ZIP / LIB51 / STRNCPY.C < prev    next >
C/C++ Source or Header  |  1997-01-12  |  267b  |  15 lines

  1. /*
  2. ** copy n characters from sour to dest (null padding)
  3. */
  4. strncpy(dest, sour, n) char *dest, *sour; int n; {
  5.   char *d;
  6.   d = dest;
  7.   while(n-- > 0) {
  8.     if(*d++ = *sour++) continue;
  9.     while(n-- > 0) *d++ = 0;
  10.     }
  11.   *d = 0;
  12.   return (dest);
  13.   }
  14.  
  15.